package com.netflexitysolutions.amazonws.sdb.internal.iterators;

import java.util.List;

import com.amazonaws.sdb.doc._2009_04_15.Select;
import com.netflexitysolutions.amazonws.sdb.Item;
import com.netflexitysolutions.amazonws.sdb.ResponseCallback;
import com.netflexitysolutions.amazonws.sdb.SimpleDB;
import com.netflexitysolutions.amazonws.sdb.internal.operations.OperationExecutor;
import com.netflexitysolutions.amazonws.sdb.internal.operations.SelectOperation;

public class SelectItemListIterator extends AbstractListIterator<Select, Item> {
	
	private String query;
	
	/**
	 * @param simpleDB
	 * @param callback
	 * @param query
	 */
	public SelectItemListIterator(SimpleDB simpleDB, ResponseCallback callback, String query){
		super(simpleDB, callback);
		this.query = query;
	}

	/* (non-Javadoc)
	 * @see com.netflexitysolutions.amazonws.sdb.internal.iterators.AbstractListIterator#prepareOperation()
	 */
	@Override
	public OperationExecutor<Select, List<Item>> prepareOperation() {
		return new SelectOperation(getSimpleDB(), getQuery(), getCallback().getNextToken());
	}

	/**
	 * @return the query
	 */
	public String getQuery() {
		return query;
	}

	/**
	 * @param query the query to set
	 */
	public void setQuery(String query) {
		this.query = query;
	}
}
